# read_byte_data.py
#
# Sample code to read first byte from a binary file.
#
# Note: For the project you might need to convert each byte to its binary representation.

filename = "test.dat"

# Open file with "wb": r-read, b-binary
file = open(filename, "rb")
# Read data into an array

first_byte = file.read(1)
if first_byte != "":
  print "Data in the first byte of binary file", filename, "is", ord(first_byte)
file.close()
